<!--
 * @Description: 
 * @Author: ZachGmy
 * @Date: 2022-08-23 16:41:57
 * @LastEditors: HeAo
 * @LastEditTime: 2022-08-23 20:28:53
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 创建一个Text文本节点
    var text1 = document.createTextNode('hello world')

    // 将文本节点添加到对应的父容器中
    document.body.appendChild(text1)

    // 追加文本内容
    text1.appendData('hello DOM')

    // 替换文本
    text1.replaceData(0, 5, 'Hi')
  </script>
</body>

</html>